import uiautomator2 as u2

d = u2.connect('emulator-5554')

if __name__ == '__main__':
    d.app_start("net.gsantner.markor_test")
    d(resourceId="net.gsantner.markor_test:id/action_go_to").click()
    d.xpath('//android.widget.ListView/android.widget.LinearLayout[5]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[1]').click()
    d.xpath('//*[@resource-id="net.gsantner.markor_test:id/ui__filesystem_item__root"]/android.widget.LinearLayout[1]').click()
    d.xpath('//*[@resource-id="net.gsantner.markor_test:id/ui__filesystem_dialog__list"]/android.widget.LinearLayout[11]/android.widget.LinearLayout[1]').long_click()
    d(resourceId="net.gsantner.markor_test:id/action_delete_selected_items").click()
    d(resourceId="android:id/button1").click()
